package cn.kawa.feign;



import cn.kawa.domain.MovieTicket;
import cn.kawa.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class MovieFeignClientFallBack implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new MovieFeignClient() {


            @Override
            public JsonResult list() {
                return JsonResult.error("调用list方法异常");
            }

            @Override
            public JsonResult get(Long id) {
                return JsonResult.error("调用get方法异常");
            }

            @Override
            public JsonResult buy(Long userId, Long movieId) {
                //return null;
                return JsonResult.error("调用buy方法异常");
            }

            @Override
            public JsonResult give(Long userId) {
                //return null;
                return JsonResult.error("调用give方法异常");
            }

            @Override
            public JsonResult watch(Long userId, Long movieId) {
                //return null;
                return JsonResult.error("调用watch方法异常");
            }
        };
    }
}
